using System;
using System.Threading;

namespace CleanCode
{
   // p. 53
   // p. 54:
   //    The proper use of comments is to compensate for our *failure*
   //    to express ourself in code. (emphasis mine)
   namespace Comments
   {
      public class SomeWtfs
      {
         // Utility method that returns when ths.closed is true.  Throws an exception
         // if the timeout is reached
         public void WaitForClose(int timeoutMillis)
         {
            if (!_isClosed)
            {
               Thread.Sleep(timeoutMillis);
               if (!_isClosed)
                  throw new Exception("could not be closed");
            }
         }
         private bool _isClosed = true;

         /************************************************************************************************/
         /************************************************************************************************/

         // the day of month
         protected string dayOfMonth;

         /************************************************************************************************/
         /************************************************************************************************/

         /// <summary>Add a CD</summary>
         /// <param name="title">The title of the CD</param>
         /// <param name="author">The author of the CD</param>
         /// <param name="tracks">The number of tracks on the CD</param>
         /// <param name="durationInMinutes">The duration of the CD in minutes</param>
         public void AddCD(string title, string author, int tracks, int durationInMinutes)
         {
         }

         /************************************************************************************************/
         /************************************************************************************************/

         /*
          * Change log
          * 11-Oct-2001: Username   Some change
          * 05-Nov-2001: Username2  Some other change
          * 12-Nov-2001: Username2  Undid the other change
          * ...
          */
         public void SomeAgedMethod()
         {
         }

         /************************************************************************************************/
         /************************************************************************************************/

         // Default constructor
         public SomeWtfs()
         {
            _isClosed = false;
         }

         /************************************************************************************************/
         /************************************************************************************************/

         /// <summary>Returns the day of the month</summary>
         /// <returns>the day of the month</returns>
         public int GetDayOfMonth()
         {
            return DateTime.Today.Day;
         }

         /************************************************************************************************/
         /************************************************************************************************/

         /// <summary>The name</summary>
         private string name;
         /// <summary>The version</summary>
         private string version;
         /// <summary>The license name</summary>
         private string licenseName;
         /// <summary>The version</summary>           // <-- OOPS! copy and paste error probably
         private string info;                         // doesn't matter since these are worthless anyway

         /************************************************************************************************/
         /************************************************************************************************/

         // Added by Rob
         public void RobsCoolMethod()
         {
         }

         /************************************************************************************************/
         /************************************************************************************************/

         public void NestingProblemsMaybe(bool someCheck)
         {
            if (someCheck)
            {
               while (someCheck)
               {
                  try
                  {
                     someCheck = false;
                  } //try
                  catch (Exception ex)
                  {
                     Console.WriteLine(ex);
                  } //catch
               } //while
            } //if
         }
      }
   }
}